import React, { Component } from 'react'
import TabControl from './TabControl/TabControl.jsx'
export class App extends Component {
  constructor(props) {
    super(props)
    this.state = {
      titles:['流行','新款','精选'],
      typeIndex:0
    }
  }
  tabClickHandle (index){
    this.setState({
      typeIndex: index
    })
  }
  render() {
    const { titles, typeIndex } = this.state
    return (
      <div className="app">
        <TabControl titles={titles} tabClick={(index) => this.tabClickHandle(index)}></TabControl>
        <h1>{titles[typeIndex]}</h1>
      </div>
    )
  }
}

export default App